import React, { Component, Suspense } from 'react';
// import { connect } from 'dva';
import { Layout, Menu, Breadcrumb, Carousel, Row, Col, Icon, List, Typography } from 'antd';
// import Ellipsis from 'ant-design-pro/lib/Ellipsis';
// import 'ant-design-pro/dist/ant-design-pro.css';
import { JIANTOU3 } from '../../constants'
import KnowMore from '@/components/KnowMore'
import KnowMore2 from '@/components/KnowMore2'
import styles from './index.less';
import {imgDomainName } from '@/constants/index'
// import router from 'umi/router';

class ActivitySliderItem extends Component {
  state = {
  };

  componentDidMount() {
  }

  componentWillUnmount() {
  }
  activityClick=(id)=>{
    // router.push(`/informationDetail?id=${id}&key=2`)
    window.open(`http://home.himedu.cn/informationDetail?id=${id}&key=2`, '_blank')
  }

  onZixunClick = () => {
    // window.open('http://plt.zoosnet.net/LR/Chatpre.aspx?id=PLT70547676&lng=cn', '_blank')
    openJesongChatByGroup(13072,25026);return false;
    // window.open('https://tb.53kf.com/code/client/e87c220968f7fcbffe4a0165dd3e04c67/1', '_blank')
  }

  render() {
    const { dataItem, onMouseEnter, onMouseLeave } = this.props;
    // console.log('ActivitySliderItem-dataItem: ', dataItem);
    return (
      <div onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave} onClick={() => this.activityClick(dataItem.id)}>
        <div style={{cursor: 'pointer', textAlign: 'center'}} onClick={this.onZixunClick}>
          <img style={{width: 150, height: 55, textAlign: 'center'}} src={'https://hua-jun-guan-wang.oss-cn-hangzhou.aliyuncs.com/%E9%A6%96%E9%A1%B5/dianjizixun.png'} />
        </div>
        <div style={{display: dataItem.isDetail ? 'none' : 'block'}}>
          {/*<img style={{height: 120}} src={imgDomainName + dataItem.coverUrl} />*/}
          <img style={{height: 130}} src={imgDomainName + dataItem.coverUrl} />
          {/*<KnowMore2 title={localStorage.getItem('umi_locale') == 'zh-CN'?dataItem.title:dataItem.titleEN} date={dataItem.createTime} />*/}
          <KnowMore2
            title={dataItem.title.length > 15 ? dataItem.title.substr(0, 15) + '...' : dataItem.title}
            date={dataItem.createTime}
          />
        </div>
        {/*<a style={{display: dataItem.isDetail ? 'block' : 'none', width: 230, margin: 'auto', padding: '0 20px' , backgroundColor: '#EA6060', color: '#FFFFFF'}}>*/}
        <a style={{display: dataItem.isDetail ? 'block' : 'none', width: '100%', margin: 'auto', padding: '0 20px' , backgroundColor: '#EA6060', color: '#FFFFFF'}}>
          <Row>
            <Col span={24} style={{ fontSize: 14, marginTop: 21 }}>
              {/*<Ellipsis tooltip lines={1}>{localStorage.getItem('umi_locale') == 'zh-CN'?dataItem.title:dataItem.titleEN}</Ellipsis>*/}
              {/*<Ellipsis tooltip lines={1}>{dataItem.title}</Ellipsis>*/}
              {/*{dataItem.title}*/}
              {dataItem.title.length > 13 ? dataItem.title.substr(0, 13) + '...' : dataItem.title}
            </Col>
          </Row>
          <Row>
            <Col span={24} style={{paddingTop: 10, height: 82}}>
              {/*<Ellipsis lines={3}>*/}
                {/*<span style={{fontSize: 12, color: '#FFE3E3'}}>*/}
                  {/*{localStorage.getItem('umi_locale') == 'zh-CN'?dataItem.synopsis:dataItem.synopsisEN}*/}
                {/*</span>*/}
              {/*</Ellipsis>*/}
              <span style={{fontSize: 12, color: '#FFE3E3'}}>
                {dataItem.synopsis.length > 67 ? dataItem.synopsis.substr(0, 67) + '...' : dataItem.synopsis}
              </span>
            </Col>
          </Row>
          <Row>
            <Col span={24} style={{textAlign: 'right', margin: '10px 0 14px 0'}}>
              <KnowMore
                icon={JIANTOU3}
                // title={<span style={{color: '#FFFFFF', fontSize: 12}}>{localStorage.getItem('umi_locale') == 'zh-CN'?'了解更多':'Know More'}</span>}
                title={<span style={{color: '#FFFFFF', fontSize: 12}}>了解更多</span>}
              />
            </Col>
          </Row>
        </a>
      </div>
    );
  }
}

export default ActivitySliderItem;
